<template>
  <ContentWrap
    class="mb-0!"
    :class="[
      footer
        ? '!h-[calc(100vh-var(--top-tool-height)-var(--tags-view-height)-var(--app-footer-height)-10px)]'
        : '!h-[calc(100vh-var(--top-tool-height)-var(--tags-view-height)-20px)]'
    ]"
    :bodyStyle="{ height: '100%', padding: '0 0 10px 0' }"
  >
    <div class="flex flex-col !h-full justify-between">
      <div class="flex">
        <slot name="tool"></slot>
      </div>
      <el-divider border-style="dashed" class="m-y-0!" />
      <el-scrollbar viewClass="flex-grow mt-10px p-x-10px">
        <el-row class="mx-0px!"
          ><el-col
            :xs="24"
            :sm="24"
            :md="24"
            :lg="24"
            :xl="24"
            v-for="(item, index) in list"
            :key="index"
          >
            <CartItem :spuItem="item" class="mb-10px! cursor-pointer">
              <template #extInfo>
                <div class="custom-text-16">
                  <!-- 实售单价:{{ fenToYuan(item.singlePrice) }}元<el-divider
                    direction="vertical"
                  />实售总价:{{ fenToYuan(item.realPrice) }}元 -->
                  <span v-if="item.leavePrice > 0" class="color-primary">
                    <!-- <el-divider direction="vertical" />  -->
                    剩余欠款:{{ fenToYuan(item.leavePrice) }}元</span
                  >
                </div>
              </template>

              <template #itemButton>
                <div class="h-full! flex flex-col justify-between p-y-5px"> </div>
              </template>
            </CartItem>

            <el-divider border-style="dashed" class="my-10px!" />
          </el-col>
        </el-row>
      </el-scrollbar>

      <div class="flex justify-end">
        <slot name="bottom"></slot>
      </div>
    </div>
  </ContentWrap>
</template>
<script lang="ts" setup>
import { propTypes } from '@/utils/propTypes'
import { fenToYuan } from '@/utils'
import { useAppStore } from '@/store/modules/app'

const appStore = useAppStore()
const footer = computed(() => appStore.getFooter)

const emit = defineEmits(['handelEdit'])
defineOptions({ name: 'CartList' })
defineProps({
  // 选中的门店列表
  list: propTypes.arrayOf(propTypes.object).def([]),
  rebateType: propTypes.number
})
import CartItem from './CartItem.vue' //购物车普通商品
</script>
<style lang="scss">
.meton-input-number {
  .el-input {
    font-size: 16px;
  }
  .el-input__inner {
    font-weight: bold;
  }
}
</style>
